package shotgun.my.sweetutil.mytest;

import cn.hutool.core.io.FileUtil;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class LinKUtil {


    public static void main(String[] args) {
        String path = "C:\\Users\\Administrator\\Desktop\\";

        List<String> userStrs = FileUtil.readLines(path + "名单.txt", "UTF-8");


        List<String> qqs = userStrs.stream().filter(s -> {
            String[] split = s.split("\t");
            String name = split[0];

            if (getNumCount(Optional.ofNullable(name).orElse("")) > 8) {
                //群昵称大于8个数字
                return true;
            } else {
                return false;
            }
        }).map(s -> {
            String[] split = s.split("\t");
            String qq = split[1];
            return qq;
        }).collect(Collectors.toList());

        FileUtil.writeLines(qqs, path + "名单result.txt", "UTF-8");

        System.out.println("ok");

    }


    private static int getNumCount(String s) {
        int numCount = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {//判断字符串中的字符是否为数字
                numCount++;
            }
        }
        return numCount;
    }
}
